<?php

/*
 * Copyright by Aion-Germany.net | inZane
 * Created for AionFinish
 * All Rights Reserved 2012-2013
 */
// needet includes
require_once('_libs/Smarty/Smarty.class.php');
require_once('_libs/mysql.php');
require_once('_libs/config.php');
if(file_exists('install/index.php')) {
	echo '<div id="installer">Please delete the Install Folder</div>';
}
$sql = 'SELECT * FROM '.DB_CMS.'.website_settings';
$dbh = $connection->query($sql);
$settings = $dbh->fetch(PDO::FETCH_ASSOC);

$websitetitle		= $settings['title'];
$smarty->assign('websitetitle', $websitetitle);
$main = new main;
// Load Stylesheets
$main->load_stylesheet('main.css');
$main->load_stylesheet('basic.css');
$main->load_stylesheet('basic_ie.css');
$main->load_stylesheet('jmodal.css');

$main->load_javascript('jquery.js');
$main->load_javascript('jquery.simplemodal.js');

$smarty->configLoad($lang . '/login.layout.php');
if (isset($_POST['submit'])) {
    $user = new user;
    if ($user->login($_POST['username'], $_POST['password'])) {
	$main->jqmodal('logged');
        echo '<meta http-equiv="refresh" content="3; URL=index.php">';
    } else {
        $main->jqmodal('notloggedin');
    }
}
if(isset($_POST['login'])) {
    $main->jqmodal('lostpassword');
}
$smarty->assign('websitetitle', $websitetitle);
$smarty->display('_layout/' . $theme . '/login.tpl');
?>